<?php
/**
 * @author Amissah Gideon<kuulmek@yahoo.com>
 * @access public
 * @version 1.0
 */

?>
<script type="text/javascript">
    var gbl_currency_opts = <?php echo json_encode($currency_opts); ?>;
    //console.log(global_equipment_data);
</script>

<!-- Main content -->
<section role="main" id="main">

    <!-- Header -->
    <?php
        echo $this->element('page_header');
        echo $this->element('navigations/report_navbar');
    ?>

    <div class="with-padding">
        <div class="columns">
            <div class="new-row-mobile twelve-columns six-columns-tablet twelve-columns-mobile">

                <h3 class="thin underline">Financial Reporting</h3>

                <div class="six-columns twelve-columns-tablet" style="margin-bottom: 20px;">
                    <fieldset class="fieldset">
                        <legend class="legend">Date Input</legend>
                        <p class="button-height inline-label">
                            <label class="label">Start Date:</label>
                            <span class="input">
                                <?php echo $this->Form->input('start_dt', array('type'=>'text','id'=>'start_dt', 'class' => 'input-unstyled', 'value'=>''.date("F d, Y", strtotime(date("Y-m-01"))).'','readonly' => 'readonly','div' => false, 'label' => false,)); ?>
                                <a href="javascript:void(0)" class="button compact" id="start_dt_btn">Date</a>
                            </span>
                        </p>
                        <p class="button-height inline-label">
                            <label class="label">End Date:</label>
                            <span class="input">
                                <?php echo $this->Form->input('end_dt', array('type'=>'text','id'=>'end_dt', 'class' => 'input-unstyled',  'value'=>''.date("F d, Y", strtotime(date("Y-m-t"))).'','readonly' => 'readonly','div' => false, 'label' => false,)); ?>
                                <a href="javascript:void(0)" class="button compact" id="end_dt_btn">Date</a>
                            </span>
                        </p>
                        <p class="button-height inline-label">
                            <label for="reload-btn" class="label">&nbsp;</label>
                            <button type="button" class="button" id="reload-btn">
                                <span class="button-icon green-gradient"><span class="icon-undo"></span></span>
                                Re Query
                            </button>
                        </p>
                    </fieldset>
                </div>

                <table id="flex" style="display:none;"></table>

                <form id="print-export-form" method="post" action="<?php echo $this->Html->url(array('controller' => 'Report', 'action' => 'print_export_interest_analysis')); ?>" target="PrintExportWindow">
                    <input type="hidden" name="data_type" id="data_type" value="" />
                    <input type="hidden" name="data_ids" id="data_ids"  value="" />
                    <input type="hidden" name="pe_currency" id="pe_currency"  value="" />
                    <input type="hidden" name="pe_customer_id" id="pe_customer_id"  value="" />
                    <input type="hidden" name="pe_start_dt" id="pe_start_dt"  value="" />
                    <input type="hidden" name="pe_end_dt" id="pe_end_dt"  value="" />
                </form>

                <?php /*echo 'Customer :'.$report_data['Customer']['name'].'<br />'; */?><!--
                --><?php /*echo 'Sales Purchase date :'.$report_data['Sale']['purchased_date']; */?>
                <!--<table id="invoice_table" class="table table-bordered">
                    <thead>
                        <tr>
                            <th>Date</th>
                            <th>Period</th>
                            <th>Expected</th>
                            <th>Paid</th>
                            <th>Outstanding</th>
                            <th>Expected Interest</th>
                            <th>Actual Interest</th>
                            <th>Amor Principle</th>
                            <th>Amor Balance</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php
/*
                        foreach($report_data['Sale']['repayment'] as $repay ){
                    */?>
                        <tr>
                            <th><?php /*echo $repay[0]; */?></th>
                            <th><?php /*echo $repay[1]; */?></th>
                            <th><?php /*echo $repay[2]; */?></th>
                            <th><?php /*echo $repay[3]; */?></th>
                            <th><?php /*echo $repay[4]; */?></th>
                            <th><?php /*echo $repay[5]; */?></th>
                            <th><?php /*echo $repay[6]; */?></th>
                            <th><?php /*echo $repay[7]; */?></th>
                            <th><?php /*echo $repay[8]; */?></th>
                        </tr>
                    <?php
/*                        }
                    */?>
                    </tbody>
                </table>-->
            </div>
        </div>
    </div>

    <!-- default values -->
    <input type="hidden" id="start_dt_val" value="<?php echo date("Y-m-01"); ?>" />
    <input type="hidden" id="end_dt_val" value="<?php echo date("Y-m-t"); ?>" />

</section>
<!-- End main content -->

<!-- Side tabs shortcuts -->
<?php echo $this->element('side_tabs_shortcuts'); ?>
<!-- Sidebar/drop-down menu -->
<?php echo $this->element('right_side_infos'); ?>

<!-- Users URL -->
<input type="hidden" id="table-url" value="<?php echo $this->Html->url(array('controller' => 'Report', 'action' => 'interest_analysis')); ?>"/>
<input type="hidden" id="print-export-sales_item-url" value="<?php echo $this->Html->url(array('controller' => 'Report', 'action' => 'print_export_interest_analysis')); ?>"/>

<!-- Images URL -->
<input type="hidden" id="calender-src" value="<?php echo $this->Html->url('/img/calender.png'); ?>" />



<!-- Users URL -->

<?php
echo $this->Html->script('setup.js');

/** Template functions **/
echo $this->Html->script('developr.input.js');
echo $this->Html->script('developr.message.js');
echo $this->Html->script('developr.modal.js');
echo $this->Html->script('developr.navigable.js');
echo $this->Html->script('developr.notify.js');
echo $this->Html->script('developr.scroll.js');
echo $this->Html->script('developr.progress-slider.js');
echo $this->Html->script('developr.tooltip.js');
echo $this->Html->script('developr.confirm.js');
echo $this->Html->script('developr.agenda.js');
echo $this->Html->script('developr.tabs.js');

echo $this->Html->script('libs/tinycon.min.js');
echo $this->Html->script('custom-scripts/interest_analysis.js');
?>